# ament wrapper for ACADO toolkit
cmake_minimum_required(VERSION 3.5)

project(acado_vendor)

find_package(ament_cmake REQUIRED)

list(APPEND extra_cmake_args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})

if(DEFINED CMAKE_TOOLCHAIN_FILE)
  list(APPEND extra_cmake_args "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
endif()

message("extra_cmake_args: ${extra_cmake_args} ====")

include(ExternalProject)

# Explicitly export include headers and libraries so ament knows about them
ament_export_include_directories(include)
ament_export_libraries(
  acado_toolkit_s # For code generation
  hpmpc)

# Install cmake helper functions
install(
  DIRECTORY cmake
  DESTINATION share/${PROJECT_NAME})

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  ament_lint_auto_find_test_dependencies()
endif()

ament_package(CONFIG_EXTRAS "acado_vendor-extras.cmake")
